/**
    @Author         :   Yehuda Roth
     Create Date    :   18/06/2010
     Last Modified  :   26/06/2010
    @Brief          :   Generic Priority Queue, holds pointers to void.
*/

#ifndef PQ_H_INCLUDED
#define PQ_H_INCLUDED

#define OUT

typedef struct _PQ_ PQ;

/*  Create PQ. Get size of Queue and comparing function     */
PQ* PQCreate(int _size, int (*CmpFunc)(void* , void*) );

/*  Return the top of priority queue                        */
void* PQTop(PQ* _pq);

/*  Pushback item to queue                                  */
int PQPushBack(PQ* _pq, void* _item);

/*  Insert at the end item to queue                         */
int PQInsert(PQ* _pq, void* _item);

/*  Sort queue according to Comparing Function              */
int PQRearrange(PQ* _pq);

/*  Pop item from queue to _item                            */
int PQPop(PQ* _pq, void** OUT _item);
void PQDestroy(PQ* _pq);

#endif /* PQ_H_INCLUDED */
